﻿<UserControl xmlns:Pages="clr-namespace:Flare.Pages" x:Class="Flare.Pages.Hards.Index"
             xmlns:Controls="clr-namespace:Flare.Controls" 
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"  
      mc:Ignorable="d"
      DataContext="{Binding RelativeSource={RelativeSource Self}}"
      xmlns:base="clr-namespace:Flare.DB"
      d:DesignHeight="600" d:DesignWidth="1200">

    <UserControl.Resources>
        <ObjectDataProvider x:Key="equipmentsDataSet" ObjectType="{x:Type base:equipments}" MethodName="Index">
            <ObjectDataProvider.MethodParameters>
                <x:NullExtension/>
                <x:NullExtension/>
                <x:NullExtension/>
                <x:NullExtension/>
                <x:NullExtension/>
                <x:NullExtension/>
                <x:NullExtension/>
                <x:NullExtension/>
            </ObjectDataProvider.MethodParameters>
        </ObjectDataProvider>

        <ObjectDataProvider x:Key="general_departmentsDataSet" ObjectType="{x:Type base:general_departments}" MethodName="Index" IsAsynchronous="False" />

        <ObjectDataProvider x:Key="general_roomsDataSet" ObjectType="{x:Type base:general_rooms}" MethodName="Index" IsAsynchronous="False">
            <ObjectDataProvider.MethodParameters>
                <x:Null/>
            </ObjectDataProvider.MethodParameters>
        </ObjectDataProvider>

        <ObjectDataProvider x:Key="equipment_typesDataSet" ObjectType="{x:Type base:equipment_types}"  MethodName="Index" />

        <ObjectDataProvider x:Key="equipment_marksDataSet" ObjectType="{x:Type base:equipment_marks}" MethodName="Index">
            <ObjectDataProvider.MethodParameters>
                <x:NullExtension/>
            </ObjectDataProvider.MethodParameters>
        </ObjectDataProvider>

        <ObjectDataProvider x:Key="equipment_modelsDataSet" ObjectType="{x:Type base:equipment_models}" MethodName="Index">
            <ObjectDataProvider.MethodParameters>
                <x:NullExtension/>
            </ObjectDataProvider.MethodParameters>
        </ObjectDataProvider>
    </UserControl.Resources>

    <Grid>

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="300" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>

        <DockPanel DockPanel.LastChildFill="False" VerticalAlignment="Top">
            <Controls:FlameMenu x:Name="Department" Caption="Отдел" SelectedValuePath="id_department" DisplayMemberPath="department" DockPanel.Dock="Top" 
                      ItemsSource="{Binding Source={StaticResource general_departmentsDataSet}}" SelectedValue="{Binding id_department, Mode=OneWay}" SelectionChanged="Department_SelectionChanged"/>

            <Controls:FlameMenu x:Name="Room" Caption="Кабинет" SelectedValuePath="id_room" DisplayMemberPath="room" DockPanel.Dock="Top"
                      ItemsSource="{Binding Source={StaticResource general_roomsDataSet}}" SelectedValue="{Binding id_room, Mode=OneWay}" SelectionChanged="Room_SelectionChanged"/>

            <Controls:FlameMenu x:Name="techType" Caption="Тип" DockPanel.Dock="Top"  SelectedValuePath="id_type" DisplayMemberPath="type"
                      ItemsSource="{Binding Source={StaticResource equipment_typesDataSet}}" SelectedValue="{Binding id_type, Mode=OneWay}" SelectionChanged="techType_SelectionChanged"/>

            <Controls:FlameMenu x:Name="techMark" Caption="Марка" DockPanel.Dock="Top" SelectedValuePath="id_mark" DisplayMemberPath="mark"
                      ItemsSource="{Binding Source={StaticResource equipment_marksDataSet}}" SelectedValue="{Binding id_mark, Mode=OneWay}" SelectionChanged="techMark_SelectionChanged" />

            <Controls:FlameMenu x:Name="techModel" Caption="Модель" DockPanel.Dock="Top" SelectedValuePath="id_model" DisplayMemberPath="model"
                      ItemsSource="{Binding Source={StaticResource equipment_modelsDataSet}}" SelectedValue="{Binding id_model, Mode=OneWay}" SelectionChanged="techModel_SelectionChanged" />
            
            <Label Name="ClearFilter" Content="Удалить фильтр" DockPanel.Dock="Top" Margin="5,40,5,40" HorizontalAlignment="Right" Style="{StaticResource StyleUrl}"  
                   PreviewMouseLeftButtonUp="ClearFilter_PreviewMouseLeftButtonUp" />
            
            <CheckBox Name="sortedLastUP" Margin="10,0,0,0" DockPanel.Dock="Top" Content="Сначала последние" Unchecked="sortedLastUP_CheckedUnchecked" 
                      Checked="sortedLastUP_CheckedUnchecked" HorizontalAlignment="Left" IsChecked="True"/>
        </DockPanel>



        <ListBox Name="techList" Grid.Column="1" Margin="20,0" ItemsSource="{Binding Source={StaticResource equipmentsDataSet}, IsAsync=True}" 
                 SelectedValuePath="id_equipment" Style="{StaticResource StyleListBox}" ItemContainerStyle="{StaticResource HardListItemTemplate}" SelectionChanged="techList_SelectionChanged">
            <!--<ListBox.ItemContainerStyle>
                <Style TargetType="{x:Type ListBoxItem}" BasedOn="{StaticResource HardListItemTemplate}">
                    <EventSetter Event="PreviewMouseLeftButtonDown" Handler="ListBoxItem_MouseLeftButtonDown" />
                    <EventSetter Event="PreviewMouseRightButtonDown" Handler="ListBoxItem_MouseRightButtonDown" />
                </Style>
            </ListBox.ItemContainerStyle>-->
        </ListBox>

    </Grid>

</UserControl>
